<template>
  <div class="BMIRecord">
    <h1>{{ msg.repeat(3) }}</h1>
    <table>
      <tr>
        <th>#</th>
        <th>Date</th>
        <th>Height</th>
        <th>Weight</th>
        <th>BMI</th>
        <th>Opt</th>
      </tr>
      <BMIItem
        v-for="(item, index) of bmiList"
        :key="item.id"
        :record="item"
        :index="index + 1"
        @delete-item="delItem"
      >
      </BMIItem>
    </table>
  </div>
</template>

<script>
import BMIItem from "@/components/BMIItem";

export default {
  name: "BMIRecord",
  components: {
    BMIItem
  },
  props: {
    msg: {
      type: String,
      default: "默认的标题"
      // required: true
    },
    // bmiList: Array
    bmiList: {
      type: Array,
      default: () => []
      // required: true
    }
  },
  methods: {
    delItem(id) {
      this.$emit("delete-item", id)
    }
  }
}
</script>
